import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()],
    build: {
      
    }
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src'),
        '@': resolve('./')
      }
    },
    css: {
      postcss: './postcss.config.js'
    },
    plugins: [react()],
    build: {
      minify: 'esbuild',
      cssCodeSplit: false,
      assetsInlineLimit: 4096, // 小于4KB的文件转base64
      rollupOptions: {
        output: {
          manualChunks: () => 'everything.js' // 强制单文件
        }
      }
    }
  }
})
